﻿using System.Runtime.InteropServices;

namespace DimensionsHelper.Client.WinUi.Helpers;

internal static partial class WindowHelper
{
    [LibraryImport("user32.dll", SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    private static partial bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);

    private static readonly IntPtr HWND_TOPMOST = new(-1);
    private const uint SWP_NOMOVE = 0x0001;
    private const uint SWP_NOSIZE = 0x0002;

    public static void SetWindowTopMost(IntPtr hWnd)
    {
        // Set the window to be topmost
        SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
    }
}
